﻿#ifndef __MINITYPE_H__
#define __MINITYPE_H__

#ifdef __cplusplus
extern "C" {
#endif

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))

typedef unsigned char       byte;
typedef unsigned int        uint;
typedef unsigned int        ubool;
typedef unsigned long       ulong;
typedef void                *lpvoid;

typedef signed char         int8;
typedef unsigned char       uint8;
typedef signed short        int16;
typedef unsigned short      uint16;
typedef signed int          int32;
typedef unsigned int        uint32;

#define nullptr             (0)

#define make_uint16(a, b)   ((uint16)(((byte)((uint)(a) & 0xff)) | ((uint16)((byte)((uint)(b) & 0xff))) << 8))
#define make_uint32(a, b)   ((uint32)(((uint16)((uint)(a) & 0xffff)) | ((uint32)((uint16)((uint)(b) & 0xffff))) << 16))
#define lo_uint16(l)        ((uint16)((uint)(l) & 0xffff))
#define hi_uint16(l)        ((uint16)((uint)(l) >> 16))
#define lo_byte(w)          ((byte)((uint)(w) & 0xff))
#define hi_byte(w)          ((byte)((uint)(w) >> 8))

typedef struct miniPoint
{
    int x;
    int y;
} miniPoint;

typedef struct miniSize
{
    int cx;
    int cy;
} miniSize;

typedef struct miniRect
{
    int left;
    int top;
    int right;
    int bottom;
} miniRect;

typedef struct miniARGB
{
    union
    {
        struct
        {
            byte blue;
            byte green;
            byte red;
            byte alpha;
        };
        uint32 argb;
    };
}miniARGB;

#ifdef __cplusplus
}
#endif/*__cplusplus*/

#endif
